<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Activitypoint_model extends CI_Model {

	function __construct() {
		parent::__construct();

		$this->load->library('LogSql');
	}

	/**
	 * 활동 포인트 리스트 가져오기
	 */
	function select_activity_to_point_list() {
		log_message('debug',"### Activitypoint_model::select_activity_to_point_list()");

		$query = $this->db->get('tb_activity_to_point') or $this->logsql->log_sql('error');
		$result = $query->result_array();

		$this->logsql->log_sql();
		$this->logsql->log_result($result);

		return $result;
	}

	/**
	 * 활동 포인트 업데이트
	 */
	function update_activity_to_point($activitypoint) {
		log_message('debug',"#### Activitypoint_model::update_activity_to_point($activitypoint)");

		$this->db->set('update_dt', 'now()', FALSE);
		$this->db->where('idx', $activitypoint['idx']);
		$this->db->update('tb_activity_to_point', $activitypoint) or $this->logsql->log_sql('error');

		$this->logsql->log_sql();
	}

	// 활동 포인트 등록
	function insert_activity_to_point($activitypoint) {
		log_message('debug',"#### Activitypoint_model::insert_activity_to_point($activitypoint)");

		$this->db->set('create_dt', 'now()', FALSE);
		$this->db->set('update_dt', 'now()', FALSE);
		$this->db->insert('tb_activity_to_point', $activitypoint) or $this->logsql->log_sql('error');

		$this->logsql->log_sql();
	}

	// 활동 포인트 삭제
	function delete_activity_to_point($idx) {
		log_message('debug',"#### Activitypoint_model::delete_activity_to_point($idx)");

		$this->db->delete('tb_activity_to_point', array('idx'=>$idx)) or $this->logsql->log_sql('error');

		$this->logsql->log_sql();
	}

}

/* End of file cashpoint_model.php */
/* Location: ./application/models/product/cashpoint_model.php */